
<template>
  <el-table
    :data="list"
    border
    style="width: 100%">
   <el-table-column
      type="index"
      label="#"
      width="50">
    </el-table-column>
    <el-table-column
      prop="authName"
      label="权限名称"
      width="340">
    </el-table-column>
    <el-table-column
      prop="path"
      label="路径"
      width="340">
    </el-table-column>
    <el-table-column
      prop="address"
      label="权限等级">
      <template slot-scope="scope">
        <el-tag :type="scope.row.level | strLevels">{{ scope.row.level | strLevel}}</el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import { getAllRoles } from '@/api/roles.js'
import { strLevel, strLevels } from '@/filter/rights.js'
export default {
  name: 'Rights',
  data () {
    return {
      list: []
    }
  },
  methods: {
    async getRightslist () {
      const { data: { data: res } } = await getAllRoles('list')
      this.list = res
    }
  },
  filters: {
    strLevel,
    strLevels
  },
  created () {
    this.getRightslist()
  }
}
</script>

<style scoped>

</style>
